<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="content">你好！</div>
<button id="btn">请求服务器响应</button>
<script>
    document.getElementById('btn').onclick =function(){
        let xmlHttp =new XMLHttpRequest();
        xmlHttp.onreadystatechange =function () {
            if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
                document.getElementById("content").innerHTML = xmlHttp.responseText;
        }
        };
        xmlHttp.open("GET", "2_form.php", true);
        xmlHttp.send();
    };

</script>
</body>
</html>